use super::*;

/// 暴力遍历.
#[allow(unused)]
pub fn min_edge_prime_num(number: u32) -> (u128, u128) {
    let mut count_num: u128 = 1;
    let mut count_prime: u128 = 0;
    let mut length = 3;
    loop {
        // 统计
        count_num += 4;
        let corner_value = get_corner_value(length);
        for val in corner_value.into_iter() {
            if tools::miller_rabin(val) {
                count_prime += 1;
            }
        }

        // 检查比例
        let percent = (count_prime * 100 / count_num) as u32;
        // println!("DEBUG: {count_prime} / {count_num} = {percent}%");
        if percent < number {
            return (length, count_prime);
        }

        // 每一层边长加2
        length += 2;
    }
}
